package app

type DeleteOption struct {
	ClusterName string
	Name        string
	All         bool
}

func (m *Manager) Delete(option *DeleteOption) {
	if option.ClusterName == "" {
		option.ClusterName = m.DefaultCluster
	}
	cluster := m.GetCluster(option.ClusterName)
	if cluster == nil {
		return
	}
	for i, node := range cluster.Nodes {
		if option.All || node.Name == option.Name {
			cluster.Nodes = append(cluster.Nodes[:i], cluster.Nodes[i+1:]...)
			return
		}
	}
}
